define(['../../../../../js/lib/other/sweet-alert'],function() {
    return ['$scope','$location', '$interval','$timeout','bizProxy', function($scope,$location,$interval,$timeout,bizProxy) {
		$scope.$emit("top-show",'true');//顶部显示
    	$scope.$emit('menuTypeLight','mine'); 	//控制底部menu高亮
    	$scope.$emit('bub-menu','true'); 	//隐藏底部menu
    	$scope.$emit('flag-tag','17-2');//显示底部文字
    	
    	//默认值
    	$scope.newPwdAgain = _YHC_util.strToArr("");
    	var tempRandom = 2.9,tempPassword = "";
    	$scope.$emit("pwdSlidUp",7);
    	
    	//监听子集显示顶部显示
        $scope.$on('pwdChange', function(event, data) {
        	$timeout(function(){
        		if(data.length == 6){
        			tempPassword = data;
        		}
        		$scope.newPwdAgain = _YHC_util.strToArr(data);
        	},0);
        });
    	
    	//点击获取密码数据
    	$scope.getPassword = function(){
    		$scope.$emit("pwdSlidUp",tempRandom++);
    	}
    	
    	
    	//监听第一次密码输入
    	$scope.$watch('newPwdAgain', function() {
    		if(($scope.newPwdAgain)[5] != ""){
    			if(tempPassword == transData.pwd1){
    				transData.pwd2 = tempPassword;
    				$timeout(function(){
    					submitPwdInfo();
    				},200);
    			}else{
    				$scope.$emit("promptAlertMsg","密码不一致，请重新输入");
    				$scope.$emit("showCollect",true);
    				$timeout(function(){
    					$scope.$emit("showCollect",false);
    					history.back();
    				},transData.promptTime);
    			}
    		}
		});
    	
    	
    	//提交信息到代理
    	function submitPwdInfo(){
    		var headerInfo = {},sendData = {};
        	headerInfo.pageNum = '';
        	headerInfo.pageSize = '';
        	headerInfo.sessionId = transData.sessionId;
        	
    		sendData.mobileNo = transData.mobileNo;
    		sendData.oldPassword = transData.password;
    		sendData.newPassword = tempPassword;
    		$scope.$emit("loadingChange",true);
    		bizProxy.queryProxyBizData("changePwd",headerInfo,sendData,
    				function(tempData){//SUCCESS
		    			//清空相关数据
    					$scope.$emit("loadingChange",false);
    					transData.pwd2 = "",transData.pwd1 = "";
						$scope.$emit("goNext","/modifyPwdSuccess");
		    		},function(data){//FAIL
		    			if(data != ""){
		    				$scope.$emit("loadingChange",false);
		    				$scope.$emit("promptAlertMsg",data.errorMsg);
		    				$scope.$emit("showCollect",true);
		    				$timeout(function(){
		    					$scope.$emit("showCollect",false);
		    					if(transData.userType === "1"){
		    						$scope.$emit("goNext","/mineLs");
		    					}else{
		    						$scope.$emit("goNext","/minePt");
		    					}
		    				},transData.promptTime);
		    			}else{
		    				$scope.$emit("loadingChange",false);
		    				$scope.$emit("promptAlertMsg","连接超时");
		    				$scope.$emit("showCollect",true);
		    				$timeout(function(){
		    					$scope.$emit("showCollect",false);
		    					if(transData.userType === "1"){
		    						$scope.$emit("goNext","/mineLs");
		    					}else{
		    						$scope.$emit("goNext","/minePt");
		    					}
		    				},transData.promptTime);
		    			}
		    		});
    	}
    	
    	//当键盘被销毁的时候
        $scope.$on("$destroy", function() {
        	$scope.$emit("pwdSlidUp","");
	    });
        $scope.$apply();
    }];
});